<template>
  <div id="main" />
</template>

<script>
import * as echarts from 'echarts'

export default {
  data() {
    return {}
  },
  created() {},

  mounted() {
    this.initEcharts()
  },

  methods: {
    initEcharts() {
      // 基于准备好的dom，初始化echarts实例
      var myChart = echarts.init(document.getElementById('main'))
      // 绘制图表
      const option = {
        title: {
          text: 'Basic Radar Chart'
        },
        legend: {
          data: ['张三', '李四']
        },
        radar: {
          // shape: 'circle',
          // 数据
          indicator: [
            { name: '工作效率', max: 100 },
            { name: '考勤', max: 100 },
            { name: '积极性', max: 100 },
            { name: '帮助同事', max: 100 },
            { name: '自主学习', max: 100 },
            { name: '正确率', max: 100 }
          ],
          // 文字颜色
          axisName: {
            color: 'red'
          },
          splitLine: {
            lineStyle: {
              color: ['red', 'green']
            }
          },
          splitArea: {
            areaStyle: {
              color: ['red', '#26C3BE', '#64AFE9', '#428BD4'],
              shadowColor: 'rgba(0, 0, 0, 0.2)',
              shadowBlur: 10
            }
          }
        },
        series: [
          {
            name: '预算 vs 开销（Budget vs spending）',
            type: 'radar',
            data: [
              {
                value: [10, 1, 100, 5, 100, 0],
                name: '张三'
              },
              {
                value: [50, 50, 50, 50, 50, 10],
                name: '李四'
              }
            ]
          }
        ]
      }
      myChart.setOption(option)
    }
  }
}
</script>

<style lang='less' scoped>
#main {
  width: 600px;
  height: 400px;
}
</style>
